<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2014.07.23.
   家居公司商家系统管理员留言模型($$)*/

!defined('Q_PATH') && exit;

class JiajucompanymessageModel extends CommonModel{

	static public function init__(){
		return array(
			'table_name'=>'jiajucompanymessage',
			'check'=>array(
				'jiajucompanymessage_refmodule'=>array(
					array('max_length',20,Q::L('消息模块不能超过20个字符','__APPJIAJU_COMMON_LANG__@Model')),
				),
				'jiajucompanymessage_content'=>array(
					array('require',Q::L('消息内容不能为空','__APPJIAJU_COMMON_LANG__@Model')),
					array('max_length',256,Q::L('消息内容不能超过256个字符','__APPJIAJU_COMMON_LANG__@Model')),
				),
			),
		);
	}

	static function F(){
		$arrArgs=func_get_args();
		return ModelMeta::instance(__CLASS__)->findByArgs($arrArgs);
	}

	static function M(){
		return ModelMeta::instance(__CLASS__);
	}

	protected function beforeSave_(){
		$this->jiajucompanymessage_refmodule=C::text($this->jiajucompanymessage_refmodule);
		$this->jiajucompanymessage_content=C::text($this->jiajucompanymessage_content);
	}

	public function send($sMessage,$nCpId,$nRefId=0,$sRefModule=''){
		$this->jiajucompanymessage_refid=$nRefId;
		$this->jiajucompanymessage_refmodule=$sRefModule;
		$this->jiajucompanymessage_content=$sMessage;
		$this->jiajucompanymessage_status=0;
		$this->jiajucompany_id=$nCpId;
		$this->save();
	}

}
